//
//  DYUpdatePhoneView.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/21.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYUpdatePhoneView.h"
#import "DYUpdatePasswordView.h"
#import "DYUpdateCodeView.h"

@interface DYUpdatePhoneView ()

@property (nonatomic,strong)DYUpdatePasswordChildView *phoneView;
@property (nonatomic,strong)DYUpdatePasswordChildView *newsPhoneView;
@property (nonatomic,strong)DYUpdateCodeView *codeView;
@property (nonatomic,strong)DYUpdateCodeView *newscodeView;
@property (nonatomic,strong)UIButton *submitButton;

@end

@implementation DYUpdatePhoneView

-(instancetype)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if (self) {
        [self initView];
    }
    return self;
}
-(void)initView
{
    self.backgroundColor=WhiteColor;
    
    self.phoneView=({
        DYUpdatePasswordChildView *view=[[DYUpdatePasswordChildView alloc]init];
        view.seeButton.hidden=YES;
        view.textField.secureTextEntry=NO;
        view.titleLabel.text=@"手机号";
        view.textField.text=@"15578837101";
        view;
    });
    
    self.codeView=({
        DYUpdateCodeView *view=[[DYUpdateCodeView alloc]init];
        view;
    });
    
    self.newscodeView=({
        DYUpdateCodeView *view=[[DYUpdateCodeView alloc]init];
        view;
    });
    
    self.newsPhoneView=({
        DYUpdatePasswordChildView *view=[[DYUpdatePasswordChildView alloc]init];
        view.titleLabel.text=@"新手机号";
        view.textField.placeholder=@"请输入新手机号";
        [view.textField setValue:[UIColor xhq_assist] forKeyPath:@"_placeholderLabel.textColor"];
        view.seeButton.hidden=YES;
        [view.textField setNumbersKeyboard];
        view.textField.secureTextEntry=NO;
        view;
    });
    
    self.submitButton =({
        UIButton * button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:[UIColor xhq_base] action:@selector(submitButtonClick) target:self title:@"保存修改" image:@"icon_login" font:17 textColor:WhiteColor];
        [button xhq_cornerRadius:BILIHEIGHT(19)];
        button;
    });
    
    [self addSubview:self.phoneView];
    [self addSubview:self.newsPhoneView];
    [self addSubview:self.codeView];
    [self addSubview:self.newscodeView];
    [self addSubview:self.submitButton];
    
    
    [self.phoneView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(BILIWIDTH(10));
        make.right.equalTo(BILIWIDTH(-10));
        make.top.equalTo(BILIHEIGHT(10));
        make.height.equalTo(BILIHEIGHT(58));
    }];
    
    [self.codeView makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.height.equalTo(self.phoneView);
        make.top.equalTo(self.phoneView.bottom);
    }];
    
    [self.newsPhoneView makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.codeView.bottom);
        make.left.right.height.equalTo(self.phoneView);
    }];
    
    [self.newscodeView makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.newsPhoneView.bottom);
        make.left.right.height.equalTo(self.phoneView);
    }];
    
    [self.submitButton makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.newscodeView.bottom).offset(BILIHEIGHT(30));
        make.right.equalTo(BILIWIDTH(-10));
        make.size.equalTo(CGSizeMake(BILIWIDTH(132), BILIHEIGHT(38)));
    }];
    
    [self.submitButton placeImageTitlePosition: ZYButtonImagePositionRight space:BILIWIDTH(10)];
    
}

-(void)submitButtonClick
{
    
}
@end
